package com.example.shopspring.Model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

@Data
@TableName("carts")
public class Cart {
    @TableId(type = IdType.AUTO)
    private int id;
    @TableField("productId") // 添加这一行来指定数据库列名
    @NotNull(message = "产品id不能为空")
    private int productId;
    @NotNull(message = "用户名不能为空")
    private String username;
    @Min(value = 1, message = "数量不能小于1")
    @Max(value = 99, message = "数量不能大于99")
    private int num;

}
